package com.atguigu.eduservice.controller.front;

import com.atguigu.commonutils.result.R;
import com.atguigu.eduservice.entity.EduCourse;
import com.atguigu.eduservice.entity.EduTeacher;
import com.atguigu.eduservice.service.EduCourseService;
import com.atguigu.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author kabuda
 * @create 2023-05-11 20:44
 */
@RestController
@RequestMapping("/eduservice/banner")
public class BannerApiController {
    @Autowired
    private EduCourseService courseService;
    @Autowired
    private EduTeacherService teacherService;

    @GetMapping("/index")
    public R index(){
        //热门课程
        List<EduCourse> courses=courseService.indexCourse();
        //名师
        List<EduTeacher> teachers=teacherService.indexTeacher();
        return R.ok().data("courses",courses).data("teachers",teachers);
    }
}
